﻿using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using ZBJF.Warranty.BLL;
using ZBJF.Warranty.Model;

namespace ZBJF.Warranty.CustomerService.Controllers
{
    public class PubModelDialogController : Controller
    {
        /// <summary>
        /// 品牌选择
        /// </summary>
        /// <returns></returns>
        public ActionResult ProductBrandsSelector()
        {
            return View();
        }
        /// <summary>
        /// 型号选择
        /// </summary>
        /// <param name="modelCode"></param>
        /// <returns></returns>
        public ActionResult ProductModelsSelector(string modelCode)
        {
            var model = ServiceFactory.ProductModelsServiceInstance.LoadByModelCode(modelCode);
            return View(model);
        }
        /// <summary>
        /// 承保公司选择
        /// </summary>
        /// <returns></returns>
        public ActionResult InsuranceCompanySelector()
        {
            return View();
        }
        [HttpPost]
        public JsonResult GetInsuranceCompanyTree()
        {
            var list = ServiceFactory.InsuranceCompanyServiceInstance.GetInsuranceCompanyAll(false)
                     .AsNoTracking()
                     .Select(o => new
                     {
                         ID = o.ID,
                         PID = o.ParentID,
                         ParentName = o.ParentCompanyName,
                         name = o.CompanyName
                     }).ToList();
            return Json(list, JsonRequestBehavior.AllowGet);
        }
        /// <summary>
        /// 信息收集弹出框
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public ActionResult InfoCollectDialog(InsuranceWarrantyRecordInfoCollect model)
        {
            return View(model);
        }
    }
}